21. Edit the Expense Claim Form (Claim Approval State)

In this step, you edit the rules for the Claim Approval State. This is the form's configuration and behavior the claim approver experiences. First, you will make the header and details controls read-only as the approver should not change any of the requester's content. The only exception is the Approver Comments Text Area, which you will leave intact so the approver can enter any comments or questions they may have. Next, you will add rules to load the originator's content into the header and details views. This provides claim details for the approver to review prior to making their decision. The last rule saves the Approver Comments back to the Expense Claim Header SmartObject, so the approver's comments become part of the expense claim record.

  1. Edit the form initializing rule for the Claim Approval State using the table below as a guide. If a setting is not specified, assume the default value. If you need help, expand the "Show me how..." section.
    RuleConfigureNotes
    Rule
    (Edit) When the Form is Initializing
    Condition

    (None)
    Action

    (New) Specify edit state for View and Form controls

    Read-only controls:
    Set all fields to read-only except Approver Comments Text Area. Make the Approver Comments Text Area EDITABLE. This includes both the header and details views.

    NOTE: Make sure the Table control is set to Unchanged and not read-only! The table overrides all the controls it contains!

    The approver should not make any changes to the originator's content. However, they can use the Approver Comments Text Area to enter any comments or questions they may have.
    Action
    (New) Hide a Form control
    Select control:
    Submit Button Table
    The claim approver uses the Workflow Task view to select their decision and submit their response. Therefore, the submit and cancel buttons are not used and could be confusing. You will hide the layout table containing the buttons.
    Action
    (New) Execute a view method
    Load originator's header view content:
    • (View) Expense Claim Header View
    • (Method) Load
    • (configure) Map the Expense Claim Header SmartObject > ID to the Input Properties > ID
    You want to load the originator's header content into the header view so that the approver can review it prior to making their decision. Here, you are mapping the SmartObject ID for the current record over to the header view. The current record is loaded into the header view using the record ID.
    Action
    (New) Execute a view method
    Load originator's details view content:
    • (View) Expense Claim Details View
    • (Method) Get List
    • (configure) Map the Expense Claim Header SmartObject > ID to the Input Properties > Expense Claim ID
    You want to load the originator's details content into the details view so that the approver can review it prior to making their decision. Here, you are mapping the SmartObject ID for the current header record over to the details view. The Expense Claim ID is the common field between the header record and the details records. The details records that match the header record ID are loaded.
    1. From the RULES screen, edit the Claim Approval State, When the Form is Initializing rule.
      Edit Form Initializing Rule
    2. First, you will make all controls read-only, except the Approver Comments Text Area. The approver should not change any of the originator's content. They can, however, enter any questions or comments they may have into the text area. With the Actions tab active, search for
      edit state
      then click Specify edit state for View and Form controls to add it to the rule definition pane. Click (configure).
      Add Action Edit State
    3. On the Specify edit state for View and Form controls screen, make all controls READ-ONLY for the Expense Claim Header View and the Expense Claim Details View. Make the Approver Comments Text Area (header view) EDITABLE. Make sure the Table control is UNCHANGED. This is the layout table and it overrides all other settings, so you don't want it read-only! Click OK to save your changes.
      Read-Only Controls
    4. Next, you will hide the Submit Button Table so that the approver does not see the submit and cancel buttons. The approver has their own submit button on the view that is added with the actions (such as Approved, Rejected, Rework). The original submit and cancel buttons may be confusing, so you will hide them for the approver state. With the Actions tab still active, search for
      hide
      then click the Hide a Form control action to add it to the rule definition pane. Click the select control link and select Submit Button Table.
      Hide Form Control
    5. The last two actions load the originator's content into the header and details views. The approver can review this content prior to making their approval decision. With the Actions tab still active, delete the search keyword so that the default actions are loaded. Click Execute a View method to add it to the rule definition pane. Click the select View link and select Expense Claim Header View. Click the select method link and select Load. Click (configure).
      Execute View Method
    6. From the Context Browser, map the Expense Claim Form > Expense Claim Header View > Expense Claim Header SmartObject > ID to the Input Properties > ID. Click FINISH to save and exit this setting.
      Map SmartObject ID to Input Properties
    7. Now, you will add the action to retrieve the details records. Click Execute a View method once again to add a second instance of this action to the rule definition pane. Click the select View link and select Expense Claim Details View. Click the select method link and select Get List. Click (configure).
      Execute View Method
    8. From the Context Browser, map the Expense Claim Form > Expense Claim Header View > Expense Claim Header SmartObject > ID to the Input Properties > Expense Claim ID. Click FINISH to save and exit this setting. Here, you are mapping the ID from the header SmartObject to a property in the details SmartObject. All details records that match the header record ID are returned.
      Map SmartObject ID
    9. The form initializing rule should look like the image below. Click OK to save and exit rule.
      Form Initializing Rule
  2. Next, add a new action to save the Approver Comments text area back to the Expense Claim Header SmartObject. You are editing the When the Workflow View is being submitted rule for the Claim Approver State. Use the table below as a guide. If a setting is not specified, assume the default value. If you need help, expand the "Show me how..." section.
    RuleConfigureNotes
    Rule
    (Edit) When the Workflow View is being submitted
    Condition

    (None)
    Action

    (New) Execute a View method
    Save approver comments:
    • (View) Expense Claim Header View
    • (Method) Save
    • (configure) Map the Expense Claim Header View > Expense Claim Header SmartObject > ID to the Input Properties > ID. Map the Expense Claim Header View > Controls > Approver Comments Text Area to the Input Properties > Approver Comments.
    • (configure - continued) Map the System Values > Current Date > Current Date to the Destination > Approval Date.

    You want to save any comments or questions entered by the approver back to the Expense Claim Header SmartObject. Note that "save" is the equivalent to "update" in Nintex K2 terms. You are mapping the ID as well, so the system knows which record to update.

    You will also map the system value > current date to the Approval Date text box so that you have a record of when the approver made their decision.

    1. Now, you will add an action that saves any questions or comments the approver entered back to the header SmartObject. With the Claim Approval State selected, click the When the Workflow View is being submitted rule, then click Edit Rule. This is the rule that fires off when the approver clicks the submit button on the Workflow Task view. The Workflow Task view is added automatically. It contains the actions and the task submit button.
      Edit Workflow Submit Rule
    2. With the Actions tab active, click Execute a View method to add it to the rule definition pane. Click select View and select Expense Claim Header View. Click select method and select Save. Click (configure). Save is the same thing as "update" in Nintex K2 terms.
      Execute Save Method
    3. First, you will map the header SmartObject ID to the input properties so that the system knows which record to update. Map the Expense Claim Form > Expense Claim Header View > Expense Claim Header SmartObject > ID to the Input Properties > ID field.
      Next, you will map the approver comments control to the input properties to save any comments entered by the approver. Map the Expense Claim Header View > Controls > Approver Comments to the Input Properties > Approver Comments.
      Map Input Properties
    4. Now, you will map the current date to the Approval Data text box. This date shows you when the approver made their decision. Map the System Values > Current Date > Current Date to the Destinations > Approval Date field.
      Approval Date
    5. Click FINISH to save and exit the settings.
    6. The Workflow View rule should look like the image below. Click OK to save and exit the rule.
      Execute View Method
    7. Click the Save icon to save your work so far.
Review

In this step, you worked with the Claim Approval State, which represents the form's configuration and behavior the claim approver experiences. You made the header and details view controls read-only because the approver should not make any changes to the requester's claim. You hide the layout table containing the submit and cancel buttons as the approver doesn't need the buttons and it could be confusing if they are shown. You added actions to populate the header and details views with the claim content. Finally, you added an action to save any comments entered by the approver back to the SmartObject record. You should have a sense now of how you can use the same form for multiple tasks, just by editing states. In the next step, you edit the Originator Rework State.

Next Step: 22. Edit the Expense Claim Form (Originator Rework State)